<template>
    <div>
        <!--<div v-if="showSign">
            <el-dialog title="签到页面" :visible.sync="dialogFormVisible" width="85%" center>
                <el-form :model="form">
                    <el-form-item label="会议 : ">
                        <el-select v-model="form.meetingJoin" placeholder="是否参加现场会议">
                            <el-option label="参加现场会议" value="yes"></el-option>
                            <el-option label="不参加现场会议" value="no"></el-option>
                        </el-select>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button type="info" @click="dialogFormVisible = false" style="margin-right: 10%"
                               icon="el-icon-arrow-left" plain> 返 回
                    </el-button>
                    <el-button type="primary" icon="el-icon-edit-outline" style="margin-left: 10%" @click="toSign"
                               plain> 签 到
                    </el-button>
                    <i class="el-icon-warning" style="font-size:11px;display: block;margin-top:3%"> 点击签到后进入在线会议系统</i>
                </div>
            </el-dialog>
        </div>-->
        <div>
            <el-table :data="meetingList"
                      @cell-click="toMeeting">
                <el-table-column
                        prop="name"
                        label="会议名称">
                </el-table-column>
                <el-table-column
                        prop="time"
                        label="会议时间"
                        width="210px">
                </el-table-column>
            </el-table>

            <div class="page">
                <el-pagination
                        background
                        :page-size="pageSize"
                        :page-count="totalPage"
                        :current-page="pageIndex"
                        layout="prev, pager, next"

                        :total="totalRecord">
                </el-pagination>
            </div>

        </div>
    </div>
</template>

<script>
    import util from 'assets/js/util.js'

    export default {
        data() {
            return {
                showSign: false,
                dialogFormVisible: true,
                totalRecord: 0,
                totalPage: 0,
                pageIndex: 0,
                pageSize: 0,
                meetingList: [],
                form: {
                    meetingJoin: '',
                }
            }
        },
        mounted() {
            //this.id = util.getUrlParam(document.location.href, 'id');
            this.creditorId = util.getUrlParam(document.location.href, 'creditorId');

            const _self = this;
            util.ajax({
                url: `/meeting/list`,
                params: {pageSize: 10, currentPage: 0},
                success: function (data) {
                    data.data.content.forEach(_meeting => _self.meetingList.push({
                        id: _meeting.id,
                        name: _meeting.name,
                        time: util.formatDateDetail(_meeting.startTime)/* + '——' + util.formatDateDetail(_meeting.endTime),*/
                    }));
                    _self.totalRecord = data.data.totalRecord;
                    _self.currentPage = data.data.currentPage;
                    _self.pageSize = data.data.pageSize;
                    _self.totalPage = data.data.totalPage;
                    _self.pageIndex = data.data.pageIndex;

                },
            });

        },
        methods: {

            toMeeting: function (row, column, cell, event) {
                window.location.href = '../meeting/meeting-detail.html?' + 'meetingId=' + row.id +'&creditorId=' + this.creditorId;

            },
            /* toSign: function (row, column, cell, event) {
                const _self = this;
                util.ajax({
                    url: ``,
                    params: {},
                    success: function (data) {

                        if (this.form.meetingJoin === '') {
                            alert('请选择是否参加现场会议!!!');
                            return
                        }
                        this.dialogFormVisible = false;

                        if (this.form.meetingJoin === -1)
                            this.dialogFormVisible = true;
                        else
                            window.location.href = '../meeting/meeting-detail.html?' + 'meetingId=' + row.id;

                    },
                });


            },*/
        }
    }
</script>

<style>
    .page {
        text-align: center;
        position: fixed;
        bottom: 10%;
        left: 0;
        right: 0;
        width: 100%;
    }
</style>
